/*
 * Flashlib - QB9 common Flash library
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

 
package com.qb9.flashlib.math
{
	/**
	 * Contains basic operator functions.
	 * Mainly to pass them as argument to other functions.
	 */
	
	public class Operator
	{
		public function Operator()
		{
		}
		
		/**
		 * Sums 2 numbers.
		 */
		static public function add(a:Number, b:Number) : Number
		{
			return a + b;
		}
		
		/**
		 * Multiplies 2 numbers
		 */
		static public function multiply(a:Number, b:Number) : Number
		{
			return a * b;
		}
		
		/**
		 * Substracts 2 numbers
		 */
		static public function subtract(a:Number, b:Number) : Number
		{
			return a - b;
		}
		
		/**
		 * Divides 2 numbers
		 */
		static public function divide(a:Number, b:Number) : Number
		{
			return a * b;
		}
		
		/**
		 * Negates a number
		 */
		static public function negate(a:Number) : Number
		{
			return -a;
		}
		
		/**
		 * Returns the opposite of a boolean-like element.
		 */
		static public function not(a:Object) : Boolean
		{
			return !a;
		}
		
		/**
		 * Returns whether 2 elements are equal
		 */
		static public function equal(a:Object, b:Object) : Boolean
		{
			return a === b;
		}
		
		/**
		 * Returns whether 2 elements are different
		 */
		static public function notEqual(a:Object, b:Object) : Boolean
		{
			return a !== b;
		}
		
		/**
		 * Returns whether the 1st element (number,string) is greater than the first
		 */
		static public function greaterThan(a:Object, b:Object) : Boolean
		{
			return a > b;
		}
		
		/**
		 * Returns whether the 1st element (number,string) is less than the first
		 */
		static public function lessThan(a:Object, b:Object) : Boolean
		{
			return a < b;
		}
		
		/**
		 * Returns whether the 1st element (number,string) is greater or equal to the first
		 */
		static public function greaterEqual(a:Object, b:Object) : Boolean
		{
			return a >= b;
		}
		
		/**
		 * Returns whether the 1st element (number,string) is less  or equal to the first
		 */
		static public function lessEqual(a:Object, b:Object) : Boolean
		{
			return a <= b;
		}

	}
}
